/*
 * @Timur Suleimanov, Kiev 2012
 * Prime numbers
 * Program to find prime numbers smaller than inputed number
 */
import java.util.Scanner;

public class PrimeNumbers {
	static final int FIRST_PROBABLE_PRIME = 2;

    public static boolean isPrimeNumber(int inputedNumber) {
        for (int i = FIRST_PROBABLE_PRIME; i < inputedNumber; i++) {
            if (inputedNumber % i == 0) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
		System.out.println("Please input a number");
        int inputedNumber = in.nextInt();
        if (inputedNumber > 0) {
            System.out.println("Your number is " + inputedNumber);
            for (int i = FIRST_PROBABLE_PRIME; i < inputedNumber; i++) {
                if (isPrimeNumber(i)) {
                    System.out.println(i + " is a prime number");
                }
            }
        } else {
            System.out.println("Please, enter only positive numbers");
        }
        in.close();
    }
}
